cap log close
log using "Z:\Angrist Work\Web Papers\Angrist_1993\Angrist1993_Table3.log", replace

****************************************
* PROGRAM: Angrist1993_Table3
* PROGRAMMER: Simone Schaner
* PURPOSE: Recreates Table 3 of Angrist
*	(1993)
* DATE CREATED: 8/6/07
* NOTES: Cannot reproduce cols 3 and 7 
*	due to missing branch of service
*	variable. Updates allowing for
*	this estimation will be posted
*	once the data is recovered
* UPDATE: 8/28/07 -- includes regs
*	using branch of service
****************************************

clear
set mem 50m
set more off

cd "Z:\Angrist Work\Web Papers\Angrist_1993"

use soviii_ang93b

* MAKE EXTRACT -- THIS PART OF CODE IS THE SAME AS THE CODE FOR TABLE 1

g byte vietnam= q4c8==1
g byte earlyavf= q4c9==1

g byte age= (agerec==2)*22 + (agerec==3)*27 + (agerec==4)*32 + ///
	(agerec==5)*37 + (agerec==6)*42 + (agerec==7)*47 + ///
	(agerec==8)*52 + (agerec==9)*57 + (agerec==10)*62 + ///
	(agerec==11)*67
replace age=. if agerec<2 | agerec>11	

g yrsrv= (q13c==2)*1.75 + (q13c==3)*4 + (q13c==4)*8 + (q13c==5)*13
	replace yrsrv=. if q13c<2 | q13c>5

g byte female= sex==2

g entgrade= (q15a==1)*0 + (q15a==2)*8 + (q15a==3)*9 + ///
	(q15a==4)*10 + (q15a==5)*11 + (q15a==6)*12 + ///
	(q15a==7)*13 + (q15a==8)*13 + (q15a==9)*14 + ///
	(q15a==10)*15 + (q15a==11)*16 + (q15a==12)*17 + ///
	(q15a==13)*18 + (q15a>13)*-99
		replace entgrade=20 if q15b==4
		replace entgrade=0 if entgrade<0

g curgrade= (q15c==1)*0 + (q15c==2)*8 + (q15c==3)*9 + ///
	(q15c==4)*10 + (q15c==5)*11 + (q15c==6)*12 + ///
	(q15c==7)*13 + (q15c==8)*13 + (q15c==9)*14 + ///
	(q15c==10)*15 + (q15c==11)*16 + (q15c==12)*17 + ///
	(q15c==13)*18 + (q15c>13)*-99
		replace curgrade=20 if q15d==4
		replace curgrade=0 if curgrade<0

g eddif= curgrade-entgrade

g byte drafted= q10==1
g byte officer= q12==1 | q12==2
g size=cenplsz
g byte curmar= q14a==1
g byte entmar= q14b==1
g byte entvoc= q15a==7
g byte curvoc= q15c==7

g byte health= q22c==1
g byte nonwhite= racerec>1
g byte hispanic= q3b==1
g byte knowgi= q31_3==1
g byte vcomp= q35f==1
g vcompamt= q35g*(q35g<12)
g disper= q35j*(q35j<12)
g byte usevoc= q38a==1
g byte newed= q39a==1
g byte anyaid= q39d==1
g byte anyfed= q39e1==1 | q39e2==1 | q39e3==1

g byte gibill= q39e5==1
g byte veap= q39e6==1
g byte otherva= q39e7==1 | q39e8==1
g byte anyva= gibill | veap | otherva

g byte inelig= q39f==1

g spoused= (q46a==1)*0 + (q46a==2)*8 + (q46a==3)*9 + ///
	(q46a==4)*10 + (q46a==5)*11 + (q46a==6)*12 + ///
	(q46a==7)*13 + (q46a==8)*13 + (q46a==9)*14 + ///
	(q46a==10)*15 + (q46a==11)*16 + (q46a==12)*17 + ///
	(q46a==13)*18 + (q46a>13)*-99
		replace spoused=20 if q46b5==1
		replace spoused=0 if spoused<0

g byte spsvoc= q46a==7

g byte spswork= q46c==1 | q46c==1
g byte fulltime= q47a==1
g byte parttime= q47a==2
g byte unem= q47a==3
g byte outlf= q47a==3 | q47a>5

g earn86= q59a
	g lnearn= ln(earn86)
g self86= q59b
	g lnself= ln(self86)
g spsern86= q64a
g spself86= q64b

g numdep= q68a
g byte depchild= q70a==1

g mardif= curmar-entmar

g byte hs= q39b1
g byte coll_grad= q39b2==1 | q39b3==1
g byte corresp= q39b7==1
g byte voc_tech= q39b4==1
g byte ojt_appren= q39b5==1 | q39b6==1
g byte oth_train = q39b8==1 | q39b9==1 | q39b10==1 | q39b11==1
g byte nviet= vietnam==0
g byte white= nonwhite==0

* SELECTION CRITERIA

keep if entgrade>8
keep if eddif>=0 & female==0 & (vietnam==1 | earlyavf==1)
keep if age>=32 & age<=52
keep if yrsrv~=.

keep vetwgt age agerec pser_02 pser_07 pser_08 vietnam-white branch army navy coast marine airf

* COLUMN 1
xi: reg eddif i.white*anyva vietnam officer drafted mardif i.age*i.yrsrv 
xi: reg eddif i.nonwhite*anyva vietnam officer drafted mardif i.age*i.yrsrv 

* COLUMN 2
xi: reg eddif i.vietnam*anyva nonwhite officer drafted mardif i.age*i.yrsrv 
xi: reg eddif i.nviet*anyva nonwhite officer drafted mardif i.age*i.yrsrv 

* COLUMN 3 
xi: reg eddif i.navy*anyva i.marine*anyva i.airf*anyva i.coast*anyva vietnam nonwhite officer drafted mardif i.age*i.yrsrv if branch~=.
xi: reg eddif i.army*anyva i.marine*anyva i.airf*anyva i.coast*anyva vietnam nonwhite officer drafted mardif i.age*i.yrsrv if branch~=. 
xi: reg eddif i.navy*anyva i.army*anyva i.airf*anyva i.coast*anyva vietnam nonwhite officer drafted mardif i.age*i.yrsrv  if branch~=.
xi: reg eddif i.navy*anyva i.marine*anyva i.army*anyva i.coast*anyva vietnam nonwhite officer drafted mardif i.age*i.yrsrv  if branch~=.
xi: reg eddif i.navy*anyva i.marine*anyva i.airf*anyva i.army*anyva vietnam nonwhite officer drafted mardif i.age*i.yrsrv  if branch~=.


* COLUMN 4
xi: reg eddif gibill veap otherva nonwhite vietnam officer drafted mardif i.age*i.yrsrv 

* COLUMN 5
xi: reg lnearn i.white*entgrade i.white*eddif vietnam officer drafted curmar i.age*i.yrsrv
xi: reg lnearn i.nonwhite*entgrade i.nonwhite*eddif vietnam officer drafted curmar i.age*i.yrsrv
* COLUMN 6
xi: reg lnearn i.vietnam*entgrade i.vietnam*eddif nonwhite officer drafted curmar i.age*i.yrsrv
xi: reg lnearn i.nviet*entgrade i.nviet*eddif nonwhite officer drafted curmar i.age*i.yrsrv  

* COLUMN 7 
xi: reg lnearn i.branch*entgrade i.branch*eddif vietnam nonwhite officer drafted curmar i.age*i.yrsrv  
	replace branch=0 if branch==2
xi: reg lnearn i.branch*entgrade i.branch*eddif vietnam nonwhite officer drafted curmar i.age*i.yrsrv  
	replace branch=-1 if branch==3
xi: reg lnearn i.branch*entgrade i.branch*eddif vietnam nonwhite officer drafted curmar i.age*i.yrsrv  
	replace branch=-2 if branch==4
xi: reg lnearn i.branch*entgrade i.branch*eddif vietnam nonwhite officer drafted curmar i.age*i.yrsrv  
	replace branch=-3 if branch==6
xi: reg lnearn i.branch*entgrade i.branch*eddif vietnam nonwhite officer drafted curmar i.age*i.yrsrv  

	log close

